'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 玩家联盟boss信息
 * @author sundbcn@gmail.com (sun debing)
 */

var moment = require('moment');
var modelUtil = require('../util/modelUtil');
var constantUtil = require('../util/constantUtil');
var mongoConnector = require('../libs/mongodb/mongoConnector');
/* jshint unused:false */
var roleUnionBossSchema = require('../schemas/roleUnionBossSchema.js');
var RoleUnionBoss = mongoConnector().model('RoleUnionBoss');

/**
 * 根据role_id获取model
 * @return {[type]} [description]
 */
module.exports.getByRoleId = function (role_id, cb) {
    modelUtil.getByRoleId(RoleUnionBoss, role_id, function (err, role_union_boss_model) {
        if (!!err) {
            console.error(err);
            return cb(err);
        }
        cb(null, role_union_boss_model);
    });
};

/**
 * 5点刷新刷新
 */
module.exports.onFiveRefresh = function (self, cb) {
    self.doDailyRefresh();
    cb();
};

/**
 * 每周重置玩家联盟BOSS数据
 */
module.exports.removeAll = function (cb) {
    RoleUnionBoss.remove({}).exec(cb);
};
